/*
 * SoomlaIAPEventHandler.h
 *
 *  Created on: Jan 28, 2015
 *      Author: Huy Vu
 */

#ifndef SOOMLAIAPEVENTHANDLER_H_
#define SOOMLAIAPEVENTHANDLER_H_

#include <string>
#include "Cocos2dxStore.h"

#define EVENT_ON_CURRENCY_BALANCE_CHANGED "onCurrencyBalanceChanged"
#define EVENT_ON_GOOD_BALANCE_CHANGED "onGoodBalanceChanged"
#define EVENT_ON_GOOD_EQUIPPED "onGoodEquipped"
#define EVENT_ON_GOOD_UNEQUIPPED "onGoodUnEquipped"
#define EVENT_ON_GOOD_UPGRADE "onGoodUpgrade"
#define EVENT_ON_MARKET_PURCHASE "onMarketPurchase"

using namespace std;

class SoomlaIAPEventHandler : public soomla::CCStoreEventHandler {
public:

    virtual void onBillingNotSupported();

    virtual void onBillingSupported();

    virtual void onCurrencyBalanceChanged(soomla::CCVirtualCurrency *virtualCurrency, int balance, int amountAdded);

    virtual void onGoodBalanceChanged(soomla::CCVirtualGood *virtualGood, int balance, int amountAdded);

    virtual void onGoodEquipped(soomla::CCEquippableVG *equippableVG);

    virtual void onGoodUnEquipped(soomla::CCEquippableVG *equippableVG);

    virtual void onGoodUpgrade(soomla::CCVirtualGood *virtualGood, soomla::CCUpgradeVG *upgradeVG);

    virtual void onItemPurchased(soomla::CCPurchasableVirtualItem *purchasableVirtualItem, cocos2d::__String *payload);

    virtual void onItemPurchaseStarted(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);

    virtual void onMarketPurchaseCancelled(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);

    virtual void onMarketPurchase(soomla::CCPurchasableVirtualItem *purchasableVirtualItem, cocos2d::__String *token, cocos2d::__String *payload);

    virtual void onMarketPurchaseStarted(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);

    virtual void onMarketPurchaseVerification(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);

    virtual void onRestoreTransactionsStarted();

    virtual void onRestoreTransactionsFinished(bool success);

    virtual void onUnexpectedErrorInStore(cocos2d::__String *errorMessage);

    virtual void onSoomlaStoreInitialized();

    virtual void onMarketItemsRefreshed(cocos2d::__Array *virtualItems);

    virtual void onMarketItemsRefreshStarted();

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    virtual void onMarketRefund(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
	virtual void onIabServiceStarted();
	virtual void onIabServiceStopped();
#endif
};


#endif /* SOOMLAIAPEVENTHANDLER_H_ */
